package com.xbao.dao;

import com.xbao.model.StuContract;
import com.xbao.model.StuContractExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface StuContractMapper {
    @SelectProvider(type=StuContractSqlProvider.class, method="countByExample")
    int countByExample(StuContractExample example);

    @DeleteProvider(type=StuContractSqlProvider.class, method="deleteByExample")
    int deleteByExample(StuContractExample example);

    @Delete({
        "delete from stu_contract",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into stu_contract (sid, createtime, ",
        "begintime, endtime, ",
        "subid, totalrecords, ",
        "chargetime, type, ",
        "payable, payreal, ",
        "discountrate, discount, ",
        "othercharge, comments, ",
        "operatorid, paytype, ",
        "orgid, discounttype, ",
        "singlecharge, classcharge, ",
        "onrecord, giverecords)",
        "values (#{sid,jdbcType=BIGINT}, #{createtime,jdbcType=BIGINT}, ",
        "#{begintime,jdbcType=BIGINT}, #{endtime,jdbcType=BIGINT}, ",
        "#{subid,jdbcType=BIGINT}, #{totalrecords,jdbcType=INTEGER}, ",
        "#{chargetime,jdbcType=BIGINT}, #{type,jdbcType=INTEGER}, ",
        "#{payable,jdbcType=INTEGER}, #{payreal,jdbcType=INTEGER}, ",
        "#{discountrate,jdbcType=INTEGER}, #{discount,jdbcType=INTEGER}, ",
        "#{othercharge,jdbcType=INTEGER}, #{comments,jdbcType=VARCHAR}, ",
        "#{operatorid,jdbcType=BIGINT}, #{paytype,jdbcType=INTEGER}, ",
        "#{orgid,jdbcType=BIGINT}, #{discounttype,jdbcType=INTEGER}, ",
        "#{singlecharge,jdbcType=INTEGER}, #{classcharge,jdbcType=INTEGER}, ",
        "#{onrecord,jdbcType=INTEGER}, #{giverecords,jdbcType=INTEGER})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(StuContract record);

    @InsertProvider(type=StuContractSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(StuContract record);

    @SelectProvider(type=StuContractSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="sid", property="sid", jdbcType=JdbcType.BIGINT),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="begintime", property="begintime", jdbcType=JdbcType.BIGINT),
        @Result(column="endtime", property="endtime", jdbcType=JdbcType.BIGINT),
        @Result(column="subid", property="subid", jdbcType=JdbcType.BIGINT),
        @Result(column="totalrecords", property="totalrecords", jdbcType=JdbcType.INTEGER),
        @Result(column="chargetime", property="chargetime", jdbcType=JdbcType.BIGINT),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="payable", property="payable", jdbcType=JdbcType.INTEGER),
        @Result(column="payreal", property="payreal", jdbcType=JdbcType.INTEGER),
        @Result(column="discountrate", property="discountrate", jdbcType=JdbcType.INTEGER),
        @Result(column="discount", property="discount", jdbcType=JdbcType.INTEGER),
        @Result(column="othercharge", property="othercharge", jdbcType=JdbcType.INTEGER),
        @Result(column="comments", property="comments", jdbcType=JdbcType.VARCHAR),
        @Result(column="operatorid", property="operatorid", jdbcType=JdbcType.BIGINT),
        @Result(column="paytype", property="paytype", jdbcType=JdbcType.INTEGER),
        @Result(column="orgid", property="orgid", jdbcType=JdbcType.BIGINT),
        @Result(column="discounttype", property="discounttype", jdbcType=JdbcType.INTEGER),
        @Result(column="singlecharge", property="singlecharge", jdbcType=JdbcType.INTEGER),
        @Result(column="classcharge", property="classcharge", jdbcType=JdbcType.INTEGER),
        @Result(column="onrecord", property="onrecord", jdbcType=JdbcType.INTEGER),
        @Result(column="giverecords", property="giverecords", jdbcType=JdbcType.INTEGER)
    })
    List<StuContract> selectByExample(StuContractExample example);

    @Select({
        "select",
        "id, sid, createtime, begintime, endtime, subid, totalrecords, chargetime, type, ",
        "payable, payreal, discountrate, discount, othercharge, comments, operatorid, ",
        "paytype, orgid, discounttype, singlecharge, classcharge, onrecord, giverecords",
        "from stu_contract",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="sid", property="sid", jdbcType=JdbcType.BIGINT),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="begintime", property="begintime", jdbcType=JdbcType.BIGINT),
        @Result(column="endtime", property="endtime", jdbcType=JdbcType.BIGINT),
        @Result(column="subid", property="subid", jdbcType=JdbcType.BIGINT),
        @Result(column="totalrecords", property="totalrecords", jdbcType=JdbcType.INTEGER),
        @Result(column="chargetime", property="chargetime", jdbcType=JdbcType.BIGINT),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="payable", property="payable", jdbcType=JdbcType.INTEGER),
        @Result(column="payreal", property="payreal", jdbcType=JdbcType.INTEGER),
        @Result(column="discountrate", property="discountrate", jdbcType=JdbcType.INTEGER),
        @Result(column="discount", property="discount", jdbcType=JdbcType.INTEGER),
        @Result(column="othercharge", property="othercharge", jdbcType=JdbcType.INTEGER),
        @Result(column="comments", property="comments", jdbcType=JdbcType.VARCHAR),
        @Result(column="operatorid", property="operatorid", jdbcType=JdbcType.BIGINT),
        @Result(column="paytype", property="paytype", jdbcType=JdbcType.INTEGER),
        @Result(column="orgid", property="orgid", jdbcType=JdbcType.BIGINT),
        @Result(column="discounttype", property="discounttype", jdbcType=JdbcType.INTEGER),
        @Result(column="singlecharge", property="singlecharge", jdbcType=JdbcType.INTEGER),
        @Result(column="classcharge", property="classcharge", jdbcType=JdbcType.INTEGER),
        @Result(column="onrecord", property="onrecord", jdbcType=JdbcType.INTEGER),
        @Result(column="giverecords", property="giverecords", jdbcType=JdbcType.INTEGER)
    })
    StuContract selectByPrimaryKey(Long id);

    @UpdateProvider(type=StuContractSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") StuContract record, @Param("example") StuContractExample example);

    @UpdateProvider(type=StuContractSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") StuContract record, @Param("example") StuContractExample example);

    @UpdateProvider(type=StuContractSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(StuContract record);

    @Update({
        "update stu_contract",
        "set sid = #{sid,jdbcType=BIGINT},",
          "createtime = #{createtime,jdbcType=BIGINT},",
          "begintime = #{begintime,jdbcType=BIGINT},",
          "endtime = #{endtime,jdbcType=BIGINT},",
          "subid = #{subid,jdbcType=BIGINT},",
          "totalrecords = #{totalrecords,jdbcType=INTEGER},",
          "chargetime = #{chargetime,jdbcType=BIGINT},",
          "type = #{type,jdbcType=INTEGER},",
          "payable = #{payable,jdbcType=INTEGER},",
          "payreal = #{payreal,jdbcType=INTEGER},",
          "discountrate = #{discountrate,jdbcType=INTEGER},",
          "discount = #{discount,jdbcType=INTEGER},",
          "othercharge = #{othercharge,jdbcType=INTEGER},",
          "comments = #{comments,jdbcType=VARCHAR},",
          "operatorid = #{operatorid,jdbcType=BIGINT},",
          "paytype = #{paytype,jdbcType=INTEGER},",
          "orgid = #{orgid,jdbcType=BIGINT},",
          "discounttype = #{discounttype,jdbcType=INTEGER},",
          "singlecharge = #{singlecharge,jdbcType=INTEGER},",
          "classcharge = #{classcharge,jdbcType=INTEGER},",
          "onrecord = #{onrecord,jdbcType=INTEGER},",
          "giverecords = #{giverecords,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(StuContract record);
}